<?php
$this->title = "Profle - Medical Info";
$this->headTitle($this->title);
?>	

		
		<!-- start content -->
		<div id="medinfo_inside" class="content">
			
		<!--  Glavno meni -->
			<div id="InnerMenu">
				<?php $session = Zend_Registry::get('session');?>
				<ul >
					<li style=" display: inline; "><a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'basic'))."?id=". $this->viewuser; ?>">Basic Info</a></li>
					<li style=" display: inline; "><a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'medical'))."?id=". $this->viewuser; ?>">Medical Info</a></li>					
					<li style=" display: inline; "><a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'Interests'))."?id=". $this->viewuser; ?>">Interests</a></li>					
				</ul>
			</div>
			<?php 
				$permision = $this->basicInfo_user['ViewPermitions'];
				$flag_view =-1;
				
				switch ($permision) {
					case 0:
				        $flag_view = 1;
				        break;
				    case 1: //only me
				        $flag_view = 0;
				        break;
				    case 2://doktors
				        if ($session->user['UserType'] == 1){
				        	$flag_view = 1;				        	
				        }
				        else{
				        	$flag_view = 0;
				        }				    	
				        break;
				    case 3://firends and doctors
				        $friends_Bo = new Application_Model_DbTable_Friends();
				        $flag_view = $friends_Bo->areFriends($this->viewuser, $session->user['id']);
				        break;
				   case 4://all
				         $flag_view = 1;
				        break;
				}
			?>
				<?php if ($flag_view==1){?>
				<form id="form_medical_show" name="medical">
					<br/>
					<label for="Height"><b>Height: </b><?php echo $this->medicalInfo_user['Height'];?> cm</label><br/>
					<label for="Weight"><b>Weight: </b><?php echo $this->medicalInfo_user['Weight'];?> kg</label><br/>
					<label for="BloodGroup"><b>Bloodgroup: </b><?php echo $this->bloodgroup['Name']; ?></label><br/>
					<br/>
					<div id="threatments">
					<?php if ($this->flag_threatments == 0){?>
						<label for="CurrentThreatments:"><b>Current Threatments: </b>None</label><br/>
					<?php }
					else{ ?>
					
						<label for="CurrentThreatments:"><b>Current Threatments: </b></label><br/>
						<table id="hor-minimalist-a">
						<tr>
							<th>Name</th>
						    <th>Description</th>
						    <th>Date From</th>
						    <th>Date To</th>
						</tr>
						<?php foreach($this->threatments as $Threatment) : ?>
						  <tr>
						    <td><?php echo $Threatment['Name']; ?></td>
						    <td><?php echo $Threatment['Description']; ?></td>
						    <td><?php $dateStart = new Zend_Date($Threatment['DateStart']);  echo $dateStart->toString("dd-MM-YYYY"); ?></td>
						    <td><?php $dateStart = new Zend_Date($Threatment['DateEnd']);  echo $dateStart->toString("dd-MM-YYYY");?></td>
						  </tr>
						<?php endforeach; ?>
						</table>					
					<?php }?>
					</div>
					<br/>
					<div id="conditonas">
					<?php if ($this->flag_conditions == 0){?>
						<label for="Conditions"><b>Conditions: </b>None</label><br/>
					<?php }
					else{ ?>
					
						<label for="Conditions"><b>Conditions:  </b></label><br/>
						<table id="hor-minimalist-g">
						<tr>
							<th>Name</th>
							<th>Latin Name</th>
						    <th>Description</th>
						    <th>Have Since</th>						    
						</tr>
						<?php foreach($this->conditons as $conditon) : ?>
						  <tr>
						    <td><?php echo $conditon['Name']; ?></td>
						    <td><?php echo $conditon['LatinName']; ?></td>
						    <td><?php echo $conditon['Description']; ?></td>
						    <td><?php $dateCondtion = new Zend_Date($conditon['DateCondtion'],'dd MMMM yyyy');  echo $dateCondtion->toString("MMMM yyyy"); ?></td>						    
						  </tr>
						<?php endforeach; ?>
						</table>					
					<?php }?>
					</div>
					
					<p>&nbsp;</p>
					<div id="div_EditMedical">
								<?php if ($session->user['id'] == $this->Query){?>					
										<a href="<?php echo $this->url(array('controller'=>'Profile','action'=>'medicaledit'))."?id=". $this->escape($session->user['id']) ?>">Edit info</a>
								<?php }?>
					</div>
					
				</form>
			<?php }?>
		</div>
		<!-- end content -->
